﻿/// <reference path="../../../Scripts/jquery-1.5.2.js" />
/// <reference path="../../../Scripts/jquery.validate.js" />
/// <reference path="../../../Scripts/jquery/jquery.message.js" />
/// <reference path="../../../Scripts/jquery/jquery.form.js" />

$(document).ready(function () {
    $(".mainform").validate(
    {
        submitHandler: function (form) {
            var _msg = $(form).find(".msg");

            $.message.create({ msg: "修改中...", to: _msg });

            $.ajax(
            {
                url: "/ucenter/information",
                type: "POST",
                data: $(form).form(),
                error: function () {
                    $.message.create({ msg: "系统错误 ! 请稍候重试", to: _msg, timer: 5000 });
                },
                success: function (message) {
                    if (message && message.flag) {
                        $.message.create({ msg: "修改成功!", to: _msg, timer: 5000 });
                    } else
                        $.message.create({ msg: message.msg, to: _msg, timer: 5000 });
                }
            });
        }
    });
});